package com.example.lottery_system.common.exception;

import com.example.lottery_system.common.errcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 构造控制层的异常
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ControllerException extends RuntimeException{

    private Integer code;
    private String msg;

    public ControllerException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public  ControllerException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.msg = errorCode.getMsg();
    }

}
